'''
'''

# Standard
# Related
import lx
# Local
import moopy.al.query.scene


_eval = lx.eval

def create_new_scene(preserve_current_scene=False):
    '''Create a new scene.
    
    @param preserve_current_scene: If True, this function will return the 
    user selection back to the current scene, after creating the new scene.
    
    @return: The scene.index of the new scene.
    '''
    
    if preserve_current_scene:
        current_index = moopy.al.query.scene.get_current_scene_index()
        
        _eval('scene.new')
        
        new_index = moopy.al.query.scene.get_current_scene_index()
        
        # We add one to the index, because modo commands deal with indexes
        # starting from 1, but queries from 0.
        _eval('scene.set %d' % current_index + 1)
        
        return int(new_index)
    else:
        _eval('scene.new')

        return moopy.al.query.scene.get_current_scene_index()
